Xbasic

INT Function

Syntax

Integer_Result as N = INT(N number)

Arguments

number

Numeric

Description

Returns the integer part of a number.

Discussion

INT() truncates the decimal portion of the specified Number and returns the remaining integer.

Example

int(1.9) -> 1
int(SALARY/12) -> 2125, if SALARY contains 25510

Here is a way to convert inches to yards, feet, and inches. Assume your table contains a field, LENGTH, which contains a length in inches. Suppose you want to print a report showing YARDS, FEET, and INCHES. You can create calculated fields, using the following expression: The expression for YARDS is:

int(LENGTH/36)

The expression for FEET uses MOD(LENGTH, 36) to return the number of inches remaining after YARDS is calculated. Dividing this number by 12 and taking the result's integer part returns the number of feet:

int(mod(LENGTH, 36) / 12)

The expression for INCHES is:

mod(mod(LENGTH, 36), 12)

See Also